/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.stop.risk.alarm.controller;

import com.hopes.bizz.stop.risk.alarm.dto.LineAnalyseAlarmDTO;
import com.hopes.bizz.stop.risk.alarm.service.LineAlarmStatisticsService;
import com.hopes.boss.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 报警统计
 *
 * @author pig
 * @date 2024-02-22 15:21:15
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/statistics")
@Tag(description = "statistics", name = "报警统计")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class LineAlarmStatisticsController {

    private final LineAlarmStatisticsService lineAlarmStatisticsService;

    @Operation(summary = "日统计", description = "日统计")
    @GetMapping("/analyseByDay")
    public R alarmDataAnalyseByDay(@Valid LineAnalyseAlarmDTO lineAnalyseAlarmDTO) {
        return R.ok(lineAlarmStatisticsService.alarmDataAnalyseByDay(lineAnalyseAlarmDTO));
    }

    @Operation(summary = "月统计", description = "月统计")
    @GetMapping("/analyseByMonth")
    public R alarmDataAnalyseByMonth(@Valid LineAnalyseAlarmDTO lineAnalyseAlarmDTO) {
        return R.ok(lineAlarmStatisticsService.alarmDataAnalyseByMonth(lineAnalyseAlarmDTO));
    }

    @Operation(summary = "年统计", description = "年统计")
    @GetMapping("/analyseByYear")
    public R alarmDataAnalyseByYear(@Valid LineAnalyseAlarmDTO lineAnalyseAlarmDTO) {
        return R.ok(lineAlarmStatisticsService.alarmDataAnalyseByYear(lineAnalyseAlarmDTO));
    }

}
